package dj.framework.service;

import com.commons.utils.PageResult;
import dj.framework.domain.SysLog;
import dj.framework.service.dto.SysLogQueryCriteria;
import dj.framework.service.dto.SysLogSmallDto;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public interface SysLogService {

    /*
    分页查询
     */
    Object queryAll(SysLogQueryCriteria criteria, Pageable pageable);

    /*
    查询全部数据
     */
    List<SysLog> queryAll(SysLogQueryCriteria criteria);

    /*
    查询用户日志
     */
    PageResult<SysLogSmallDto> queryAllbyUser(SysLogQueryCriteria criteria, Pageable pageable);

    /*
    保存日志数据
     */
    @Async
    void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog sysLog);


    /**
     * 查询异常详情
     * @param id 日志ID
     * @return Object
     */
    Object findByErrDetail(Long id);

    /**
     * 导出日志
     * @param sysLogs 待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<SysLog> sysLogs, HttpServletResponse response) throws IOException;

    /**
     * 删除所有错误日志
     */
    void delAllByError();

    /**
     * 删除所有INFO日志
     */
    void delAllByInfo();
}
